Wise ordering for writes - combining spatial and temporal locality in write caches for multi-rank storage

ABSTRACT

A storage system has a storage controller for an array of storage disks, the array being ordered in an sequence of write groups. A write cache is shared by the disks. The storage controller temporarily stores write groups in the write cache responsive to write groups being written to their respective arrays. The write groups are assigned to a global queue ordered by ages. The controller selects a quantity of write groups for attempted destaging to the arrays responsive to a predetermined high threshold for the global queue and to sizes and the ages of the write groups in the global queue, and allocates the selected quantity among the arrays responsive to quantities of certain ones of the write groups in the global queue. Write groups are destaged to respective arrays responsive to the selected allocation quantity for the array and the sequences of the write groups in the arrays.

CROSS-REFERENCE

This application is related to U.S. patent application Ser. No. ______ (attorney docket ARC920050077US1), Wise Ordering For Writes—Combining Spatial and Temporal Locality in Write caches, which is filed on the same date as the present application, and the related application is hereby incorporated herein by reference.

BACKGROUND

1. Field of the Invention

The present invention concerns caching in computer systems and, more particularly, concerns write caching for disk storage devices.

2. Related Art

Processor speeds have grown about sixty percent per year, while electro-mechanical disk storage devices have improved their access times at a comparatively meager annual rate of about eight percent. At the same time, capacity of disk storage devices has grown more than fifty percent per year, which tends to reduce the amount of data available by parallel, concurrent disk access. By themselves, these trends would dictate that a processor must wait longer for disk read and write operations. Consequently, huge efforts have gone into hiding latency for disk bound computer applications.

A cache has been described by the Storage Networking Industry Association as “A high speed memory or storage device used to reduce the effective time required to read data from or write data to a lower speed memory or device.” http://www.snia.org/education/dictionary/c/ (definition of cache). Caching is a fundamental technique in hiding I/O latency and is widely used in storage controllers, databases, file systems, and operating systems. A modern storage controller's cache typically contains volatile memory used as a read cache and a non-volatile memory used as a write cache. Non-volatile storage (“NVS”), which is typically fast, but relatively expensive, random access memory, enables writes to be stored quickly and safely in an NVS write cache and destaged, i.e., written to disk storage, later in an asynchronous fashion, which hides the latency of writing to the disk storage, which is slower, but relatively less expensive than the NVS write cache. Read cache management is a well studied discipline and there are a large number of cache replacement algorithms in this context. In contrast, write caching is a relatively less developed subject.

In destaging, a balance must be obtained. Data in the write cache must be destaged quickly enough so that there is always space for incoming writes, but not so quickly that the benefit of the write cache is under utilized. This balance has been addressed, for example, by linear threshold scheduling, in which the rate of destaging is varied in response to instantaneous occupancy of the write cache. It has also been addressed by scheduling using least-cost and high/low “water” marks.

Another issue presented in destaging concerns the destaging order. As long as the write cache is drained fast enough, the precise order in which data is destaged does not affect performance from the standpoint of fairness or of write requests becoming starved because write requests are considered complete, in most respects, once they are written to the write cache. However, destage ordering can crucially affect peak write throughput and performance of concurrent reads. Peak write throughput is affected by destage ordering because the capacity of disks to physically support sequential or nearly sequential write traffic is significantly higher than their capacity to support random writes. That is, destaging writes in an order that exploits this physical fact can significantly improve peak write throughput. This was a fundamental motivation for development of log-structured file systems in a different context. Performance of concurrent reads is affected by destage ordering because to the extent destage ordering improves write performance, it improves read performance. That is, with concurrent reads and writes, the less time spent writing to a disk, the more time there is available to read from the disk.

As may be seen from this brief background, problems are presented in balancing tradeoffs involved in write caching. Problems are presented even regarding how to frame all the issues regarding write caching and in recognizing resultant interactions among the issues.

SUMMARY OF THE INVENTION

The present invention addresses the foregoing problem. According to one form of the invention, a storage system has numerous arrays of storage disks and a computer readable write cache shared by the disks of the arrays. Such a disk array has a rank of data ordered in a sequence of write groups each array. A storage controller for the arrays temporarily stores the write groups in the write cache responsive to the write groups being written to the array and lists the write groups in queues associated with the respective arrays. A method of destaging the write cache includes storing ones of the write groups in the write cache temporarily responsive to the ones of the write groups being written to their respective arrays. The write groups stored in the write cache are assigned to a global queue. The write groups in the global queue are ordered by ages of the write groups. A quantity of write groups is selected for attempted destaging to the arrays responsive to a predetermined high threshold for the global queue and to sizes and the ages of the write groups in the global queue. The selected quantity is allocated among the arrays responsive to quantities of certain ones of the write groups in the global queue, so that the arrays have respective allocation quantities of write groups for destaging. Ones of the write groups in the write cache are destaged to the arrays. Write groups are destaged to such an array responsive to i) the selected allocation quantity for the array and ii) the sequences of the write groups in the array.

In another aspect, the storage controller has an associated predetermined high threshold storage value for the write groups in the global queue. Selecting the quantity of write groups for attempted destaging to the arrays includes determining the write group in the global queue having the page corresponding to the high threshold value.

In another aspect, determining the write group in the global queue having the page corresponding to the high threshold value includes accumulating a sum of pages proceeding down the global queue until reaching a write group in the global queue having a number of pages such that when added to the accumulating sum of pages the number causes the sum to first equal or exceed the high threshold value. The write group thus reached corresponds to the high threshold storage value.

In another aspect, certain ones of the write groups in the global queue are selected, the certain ones being older than the write group corresponding to the high threshold storage value. The quantity of those selected certain ones of the write groups determines a quantity of write groups for attempted destaging to the arrays.

In another aspect, allocating the selected quantity among the arrays includes assigning the selected certain ones of the write groups stored in the write cache to array allocation queues for the respective arrays.

In another aspect, allocating the selected quantity among the arrays includes counting write groups assigned to each of the local array allocation queues to determine allocation quantities for attempted destaging to the respective arrays.

In another aspect, for the write groups in the write cache, indicia are stored in circular local queues for the write groups' respective arrays, the indicia being ordered according to the write group sequences in such arrays. In such a circular local queue a lowest one of the write groups is listed next to a highest one of the write groups. The destaging includes selecting ones of the write groups indicated in the circular local queues in quantities corresponding to the allocation quantities.

Other variations, objects, advantages, and forms of the invention will become apparent upon reading the following detailed description and upon reference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing and other objects, aspects and advantages will be better understood from the following detailed description of a preferred embodiment(s) of the invention with reference to the drawings, in which:

FIG. 1 illustrates a storage system, according to an embodiment of the present invention.

FIG. 2 illustrates certain details of the storage system of FIG. 1, according to an embodiment of the present invention.

FIG. 3 illustrates certain additional details of the storage system of FIGS. 1-2, according to an embodiment of the present invention.

FIG. 4 illustrates certain additional details of the storage controller of FIGS. 1-3, according to an embodiment of the present invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS OF THE INVENTION

In the following detailed description of the preferred embodiments, reference is made to the accompanying drawings illustrating embodiments in which the invention may be practiced. It should be understood that other embodiments may be utilized and changes may be made without departing from the scope of the present invention. The drawings and detailed description are not intended to limit the invention to the particular form disclosed. On the contrary, the intention is to cover all modifications, equivalents and alternatives falling within the spirit and scope of the present invention as defined by the appended claims. Headings herein are not intended to limit the subject matter in any way.

Overview

There are numerous incentives to improving write cache destaging performance, and, hence, overall write performance, which also leads to improved read performance, as previously stated. For one thing, the widely used redundant array of independent disks (“RAID”) technology tends to make writes slower than reads. Also, write caches are commonly smaller than read caches. Further, client side caching does not significantly benefit write operations as it does read operations. Also, the proportion of write operations in the widely used storage benchmark SPC-1 is larger than the proportion of read operations.

The present invention involves a recognition that write destaging performance depends upon a combination of factors, including (i) the total number of destages to disks, namely, the write miss ratio, and (ii) the average cost of each destage. In the absence of any read operations, it is important for a write destage algorithm to minimize the product of these factors. Even in the presence of concurrent reads, the product of these factors tends to minimize the amount of time that the disk heads are occupied in serving writes, which tends to minimize the average read response time and maximize aggregate throughput.

To minimize the first factor, the present invention seeks to exploit temporal locality, which may favor destaging segments of data least likely to be written to while in the write cache, and thus most likely to ultimately be destaged. Classically, a least recently used (“LRU”) policy has been used to exploit temporal locality in read caches. In write caches this translates to a least recently written (“LRW”) policy. Other policies that have been used in read caches for exploiting temporal locality include CLOCK, FBR, LRU-2, 2Q, LRFU, LIRS, MQ, ARC, and CAR, all of which attempt to reduce the miss ratio in a read cache.

To minimize the second factor, the present invention seeks to exploit spatial locality, which may favor destaging segments of data located closest together on the disks, and thus subject to the fastest write operation, according to the heads and the geometry of the disks in the system. A number of algorithms are known for exploiting spatial locality, including those which seek to serve I/O's on a first-come-first-serve (“FCFS”) basis, a shortest-seek-time-first (“SSTF”) basis, a shortest access time first (“SATF”) basis, and on the basis that I/O's are served first in increasing order and then in decreasing order of their logical addresses (“SCAN”). There are many other variants known as LOOK, VSCAN, FSCAN, Shortest Positioning Time First (“SPTF”), GSTF and WSTF, and largest segment per track (“LST”).

These known algorithms that are advantageous regarding spatial locality may depend upon a detailed knowledge of instantaneous position of a disk head and the location of each data segment relative to the disk head, particularly for read operations. However, the present embodiment of the invention is in the context of a storage controller at a level in a memory hierarchy that is somewhat removed from the actual disks themselves. Further, it is for write operations instead of read operations. In this context, most disk parameters are hidden, due to RAID, for example, so that spatial locality is generally hard to exploit. For example, it has been found that applying SATF at a high level in the memory hierarchy such as that of a storage controller was not practical. See L. Huang et al., Experience in Building a Software Based SATF Scheduler,” Tech. Rep. ECSL-TR81, SUNY at Stony Brook (July 2001) (“ . . . modern disks have too many internal control mechanisms that are too complicated to properly account for in the disk service time model. This exercise lead us to conclude that software-based SATF disk schedulers are less and less feasible as the disk technology evolves.”), also (“Even when a reasonably accurate software based SATF disk scheduler can be successfully built, the performance gain over a SCAN based disk scheduler that it can realistically achieve appears to be insignificant . . . ”). This conclusion regarding SATF was for mere single disk applications. For applications having an array of redundant disks, as in the context of the present embodiment of the invention, the conclusion is all the more certain.

Previous work has attempted to apply principles of both spatial and temporal locality to the problem of write cache control by partitioning the write cache into a “hot” zone managed according to an LRW policy and a “cold” zone managed via an LST policy. However, this work only deals with interaction between the cache and one disk. T. R. Haining, “Non-volatile Cache Management for Improving Write Response Time with Rotating Magnetic Media,” 126, Ph.D. Thesis, Ph.D. Dissertation, University of California, Santa Cruz (2000). Also, even with regard to a single disk, further work is needed to develop an adaptive algorithm for tuning the size of the hot zone. See id., 125 (“One of the most immediate aspects of this work requiring more research is the method to determine the size of the hot zone for the stack model based replacement algorithm. We determined the best size for the hot zone empirically in our experiments.”). The work does not fully address how to determine the best adaptive partition. In addition, the hot zone optimizes for temporal locality, whereas the cold zone for spatial locality.

In seeking to apply principles of both spatial and temporal locality for write cache control in the context of a storage controller, i.e., in upper levels of memory hierarchy, the present embodiment of the invention applies processes related to LRW for temporal locality and CSCAN for spatial locality. In CSCAN, I/O's are served only in increasing order of their logical addresses. A difficulty arises because the order of destaging that is suggested by LRW tends to be different than that of CSCAN. This difficulty is addressed in the present embodiment of the invention by a novel combination, referred to herein as Wise Ordering for Writes (“WOW”), wherein write groups in the write cache are maintained in a CSCAN-like arrangement, but with recency bits akin to those of CLOCK. (For details of CLOCK, see F. J. Corbato, “A paging experiment with the multics system,” In Honor of P. M. Morse, pp. 217-228, MIP Press, 1969.) Destaging is skipped for write groups to which data has been recently written, as indicated by the recency bits.

Described another way, the present invention frames the destaging problem as interrelated issues concerning what write data to destage and when to destage the selected write data. According to the present embodiment of the invention, the issues are defined and addressed by a novel combination of a particular kind of adaptive water mark and a particular kind of linear threshold scheduling.

An invention described in the related patent application is especially applicable when there is a single RAID rank or a single disk supported by an NVS that is dedicated solely to the rank or disk. Herein is described one or more embodiments of an invention that is particularly advantageous for an arrangement where NVS is shared by multiple RAID ranks, which is the typical case in the Shark storage system, for example. (“Shark” is a trademark of the International Business Machines Corporation.) This multi-rank arrangement gives rise to issues addressed herein regarding how to dynamically partition cache space among many RAID ranks so as to optimize throughput and response times.

Specifically, features of the present invention address the issues of adaptability, spatial locality, temporal locality and simplicity, among others, in the above described, multi-rank write cache context. Regarding adaptability, some ranks may possess more temporal locality than others at a given time. The importance of this issue may vary over time. Also, the fraction of writes being directed to any rank also varies with time. Hence, a simple policy of a priori assigning a fixed fraction of NVS to each rank is not desirable. The present invention provides an adaptive partitioning arrangement in which the amount of cache invested in each rank adaptively varies over time. Spatial locality is a local property of each rank. The present invention provides an arrangement in which data destaged to a rank tends to be spatially close to both preceding and succeeding data destaged to the same rank. Temporal locality is a global property across ranks. Giving more NVS space to one rank tends to better exploit temporal locality in requests to that rank at the expense of decreasing temporal locality in other ranks. The present invention provides an arrangement in which these tradeoffs are taken into consideration.

Regarding simplicity, it would be ideal, although not necessarily simple to do, if NVS could be allocated to each rank according to marginal utility. Marginal utility for each rank changes with work load, so such allocation would need to be adjusted dynamically. However, a typical enterprise-class storage system may have many ranks. For example, a storage system offered by IBM Corporation, the IBM DS8300 system, typically ships with forty-eight RAID ranks. The prior art suggests adjusting parameters for each individual rank for such an implementation, which is perhaps to complicated to be practical with so many ranks. The present embodiment of the invention advantageously addresses these issues in a more elegant and practical way.

Example of Destaging Context

Referring now to FIG. 1, a storage system 100 is shown according to an embodiment of the present invention. System 100 takes the form of a computer system. It should be understood that the term “computer system” is intended to encompass any device having a processor that executes instructions from a memory medium, regardless of whether referred to in terms of a microcontroller, personal computer system, mainframe computer system, workstation, server, or in some other terminology. Computer system 100 includes processors 115, a volatile memory 127, e.g., RAM and a nonvolatile memory 129. Memories 127 and 129 store program instructions (also known as a “software program”), which are executable by processors 115, to implement various embodiments of a software program in accordance with the present invention. Processor 115 and memories 127 and 129 are interconnected by bus 140. An input/output adapter (not shown) is also connected to bus 140 to enable information exchange between processors 115 and other devices or circuitry. System 100 also includes a keyboard 133, pointing device 130, e.g., mouse, floppy disk, CD-ROM, and DVD, and a display device 137.

In the illustrated embodiment, system 100 is an IBM xSeries 345 computer equipped with two Intel Xeon 2 GHz processors 115. In the illustrated embodiment, nonvolatile memory 129 includes 10K RPM, SCSI, DDR disks D1R1 through DNR1, D1R2 through DNR2, and D1R3 through DNR3, each disk being 36.4 GB each. The number of ranks and number of disks N in each rank may vary in different embodiments, of course.

Nonvolatile memory 129 also includes another disk (not shown) that is used for an operating system, software applications, and workloads. In other embodiments the operating system may be on multiple disks or on some other nonvolatile store, not necessarily a disk. In another embodiment the operating system may even be programmed in specialized chip hardware. A Linux kernel runs on system 100 for hosting the applications and standard workload generators. Memory 129 also includes ROM, which is not shown, and may include other devices, which are also not shown, such as floppy disks, CD-ROMs, and DVDs.

Referring now to FIG. 2, certain details of system 100 are illustrated according to an embodiment of the invention. SCSI disks, D1R1, etc., are configured as three RAID-10 arrays R1, R2, and R3, each having a respective set of data disks, each set being N in number. For example, array R1 has data disks D1R1, D2R1, D3R1, etc. through DNR1. Arrays R1, R2 and R3 share a RAID storage controller CXRX for controlling their respective sets of the RAID-configured disks. Each disk has its own disk controller. For example, disk D1R1 has its own disk controller C1R1, as shown. Storage controller CXRX has a single write cache WXRX for all three ranks R1, R2 and R3. In a RAID-10 embodiment of the invention as illustrated in FIG. 2, write cache WXRX is managed in terms of 64 KB strip 102 write groups. Strip 102 size may vary, of course.

For a RAID-5 embodiment, write cache WXRX is managed in terms of stripe 104 write groups. In one embodiment, strip 102 size (chunk size) for each disk D1R1, etc. is 64 KB, which results in a stripe 104 group size of 64 KB×N. Strip 102 and stripe 104 group sizes may vary, of course.

In still another embodiment of the invention, SCSI disks D1R1, etc. are configured merely as non-redundant disks. In an individual disk embodiment of the invention, single disks are managed in units of 4 KB pages.

Referring now to FIG. 3, additional details are illustrated for an embodiment of the invention. In FIG. 3, a RAID-10 implementation is illustrated, in which storage controller CXRX has a single write cache WXRX managed in terms of 64 KB strip 102 write groups, as in FIG. 2. (For simplicity of explanation each rank R1, etc. is shown with just three data disks D1R1, D2R1, D3R1, etc. It should be understood that each rank R1, etc. actually has at least one additional disk not shown, so that each rank has an even number of data disks. It should also be understood that in an embodiment of the invention a RAID-10 rank might even have merely two disks.)

Each disk D1R1, etc. is divided into strips 102, where each strip 102 is a logically and physically contiguous set of pages. Pages P1, P2, P3 and P4 are explicitly shown for one of the strips 102, although it should be understood that the pages P1, P2, etc. exist for all such strips 102. In the illustrated embodiment of the invention, the smallest unit of cache management is a 4 KB page, e.g., page P1, P2, etc. As shown in FIGS. 2 and 3, a stripe 204 is a collection of strips 202. In the illustrated embodiment, the size of each strip 102 is 64 KB and each participating disk D1R1, etc. contributes one strip 102 to a stripe 104. (Note that the embodiment illustrated has only four stripes 102 per disk D1R1, etc. It should be understood that this is merely to simplify the illustration, e.g., to make it easier to follow, and that in an actual implementation, disks D1R1, etc. conventionally have many more strips 102. Note also, due to mirroring in RAID-10 and parity in RAID-5, the effective storage provided by a stripe 104 is less than its physical size.)

In a RAID-10 embodiment of the invention, as illustrated in FIG. 3 and described herein, storage controller CXRX manages its write cache WXRX in terms of strips 102. Thus, in this particular description, a write group WG1, WG2, etc. is a strip 102. However, it should be understood that in other embodiments of the invention, a write group WG1, etc. may refer to some other memory segment, such as a page P1, P2, etc. or a stripe 104, for example. In a RAID-5 embodiment of the invention, storage controller CXRX manages the write cache WXRX in terms of stripes 104.

In FIG. 3, only nine write groups are shown. Again, this is for simplicity of illustration. It should be understood, however, that the at least one additional disk not shown per rank in the present embodiment may also have write groups that are not shown in FIG. 3, and that this would affect the sequence of write groups.

Referring to array R1, for example, in the illustrated embodiment of the present invention shown in FIGS. 2 and 3, RAID storage controller CXRX controls all the RAID-configured disks, whereas the individual disks D1R1, etc. have their own respective disk controllers C1R1, etc., as previously mentioned. However, for the entire set of three ranks of disks R1, R2 and R3, write cache WXRX is the only write cache having a battery back up that can support a fast write. No such fast write cache exists at lower levels, such as at the level of an individual disk controller C1R1, etc. Correspondingly, I/O scheduling in the embodiment of the present invention primarily concerns destaging write requests issued by storage controller CXRX.

While RAID controller CXRX may commonly implement a scheduling algorithm, and an individual disk controller, such as disk controller C1R1, may implement another, smarter disk scheduling algorithm, these smarter, disk-level scheduling concepts are not directly transferable to apply to a storage controller CXRX at its high level in memory hierarchy, as in the case of the present embodiment of the invention. Furthermore, in a conventional application in which there is a write cache for a single rank of disks, the single-rank write cache is smaller than is the multi-rank write cache for the storage controller of the present embodiment of the invention, even if the conventional single-rank write cache is compared merely to the amount of memory per rank in the storage controller multi-rank write cache of the present embodiment of the invention. Thus, scheduling algorithms for controlling multi-rank write caches are not necessarily directly transferable to single-rank controlling write caches.

The notion of a hit is more straightforward in read caching than write caching. In write caching, a hit can be a hit on a page, a strip, or a stripe. These different hits may have different payoffs. For example, in RAID-5 a page hit saves four seeks, whereas a stripe hit that is a page miss saves two seeks because of shared parity.

Arbitrary subsets of pages P1, P2, etc. in a write group WG1, etc. may be present in write cache WXRX. Write requests that access consecutively numbered write groups WG1, WG2, etc. are termed sequential. On a write request for one of the ranks R1, R2 or R3, if all pages to which the request seeks to write are found in write cache WXRX, it is deemed a write hit, and the write request is served immediately. If some of the written pages are not in the write cache WXRX but enough free page space is available, once again, the write request is served immediately. If, however, some of the written pages are not in write cache WXRX and enough free page space is not available, the write request must wait until enough page space become available. In the first two cases, the write response time is negligible. In the last case, the write response time tends to become significant. Thus, write cache WXR1 must be drained so as to avoid this situation if possible.

Selecting How Much Data to Destage

When storage controller CXRX adds a write group to write cache WXRX, i.e., responsive to a write-to-disk operation, storage controller CXRX also places indicia of that write group in a global queue LRWQ. Moreover, storage controller CXRX places the indicia for the newest write group at the top of queue LRWQ, so that the queue is sorted by age of the write groups. In other words, the write groups are effectively ranked by their respective ages due to the sorting in queue LRWQ.

In the illustrated instance shown in FIG. 3, write group WG8 in rank R1, which includes four affected pages, is the newest write group in queue LRWQ, so it is at the top of the sorted list, as shown. Next on the list is write group WG1 from rank R3, which includes 2 effected pages, etc. The oldest write group in queue LRWQ is write group WG6 from rank R3, which includes 1 effected page, so it is at the bottom of the sorted queue LRWQ.

For destaging, storage controller CXRX has a high threshold value set at a predetermined value, which may be set by an administrator. In the example shown, the high threshold value is twenty-five pages. In an alternative embodiment, the high threshold value may be in terms of write groups instead of pages. Also, in an alternative the high threshold is set to a fixed percentage of the cache size.

To determine which write group in queue LRWQ has the twenty-fifth oldest page, i.e., the page having age corresponding to the high threshold value, controller CXRX starts by placing a high threshold marker 305 at the top of queue LRWQ and moves it down the queue, adding the number of pages included in each write group to a sum of pages as it proceeds downward in queue LRWQ. Controller CXRX continues downward in this fashion until the threshold marker 305 reaches a write group in queue LRWQ having a number of pages that causes the sum of pages to first equal or exceed the threshold amount, at which point controller CXRX stops moving the marker 305.

In the illustrated instance, write group WG9 from rank R3 has the twenty-fifth oldest page in queue LRWQ, as indicated by the high threshold indicator 305, as shown. Three write groups in queue LRWQ have pages older than the pages in write group WG9 from rank R3 and are thus below write group WG9 from rank R3 in queue LRWQ, namely write group WG9 from rank R1, write group WG7 from rank R1 and write group WG6 from rank R3, as shown. Since the high threshold 305 is set at twenty-five and there are three write groups in queue LRWQ having pages older than the pages in the write group having the twenty-fifth oldest page, in the instance illustrated controller CXRX will destage three write groups from write cache CXRX.

Alternatively, controller CXRX maintains the current overall size of the global LRWQ (in terms of write groups and/or pages, depending upon the embodiment) in a global LRWQ SIZE variable that is updated every time a write group is added or removed from the global LRWQ. A write group is removed from the least recently used end of the global LRWQ, the global LRWQ SIZE variable is reduced, and the write group is moved to the appropriate local LRWQ. If the global LRWQ SIZE variable is still larger than the desired global LRWQ size, the next write group is removed from the least recently used end of the global LRWQ, the global LRWQ SIZE variable is again reduced, and the next write group is moved to the appropriate local LRWQ. This continues until the global LRWQ SIZE variable has been reduced to the desired size.

Selecting an Allocation Among the Ranks for the Selected Amount of Data to Destage

By the above described process, controller CXRX has now selected the number of write groups to destage, but not which ones of the write groups to destage. In a next step, controller CXRX allocates the above determined amount of data among the ranks. To do this, controller CXRX places, in respective local array allocation queues LWRQ_R1, LWRQ_R2, and LWRQ_R3, indicia of the three write groups from queue LRWQ that have pages older than the pages in the write group having the twenty-fifth oldest page, i.e., pages older than that indicated by high threshold 305. That is, in the illustrated instance, controller CXRX places indicia of write group WG9 from rank R1 and write group WG7 from rank R1 in local array allocation queue LWRQ_R1, and places indicia of write group WG6 from rank R3 in local array allocation queue LWRQ_R3. Next, controller CXRX adds up the number of write groups indicated for each of the local queues LWRQ_R1, LWRQ_R2, and LWRQ_R3. As shown, there are two in local queue LWRQ_R1, none in local queue LWRQ_R2, and one in local queue LWRQ_R3. Controller CXRX selects, or at least attempts to select, write groups from sorted, circular queues Q1, Q2 and Q3, for respective ranks R1, R2 and R3, in numbers corresponding to these sums. That is, controller CXRX selects, or at least attempts to select for destaging, two write groups from sorted, circular queue Q1 for rank R1 and one write group from sorted, circular queue Q3 for rank R3.

Selecting Which Data to Destage

Next, controller CXRX determines exactly which data to destage. To this end, write cache controller CXRX maintains sorted, circular lists Q1, Q2 and Q3 of the ones of the write groups WG1, WG2, etc. that are in write caches WXRX for the respective ranks R1, R2 and R3. The “sorted” aspect of lists Q1, etc. refers to the following. The storage space on array R1 of disks D1R1, etc., for example, is arranged in an ordered sequence of write groups WG1, etc. that spans the entire array R1, as shown. Indicia of the ones of the write groups WG1, etc. that are in write cache WXR1 for array R1, are included in list Q1 for cache WXR1 sorted in order of their sequence in the array R1. The “circular” aspect of lists Q1, etc. refers to an aspect of such a list wherein the lowest and the highest write groups in the list are adjacent.

The following table sets out psuedo-code for certain caching and destaging aspects of a WOW process for the individual circular queues Q1, Q2 and Q3, according to an embodiment of the present invention: TABLE ONE CACHE MANAGEMENT POLICY: Page x in write group s is written: 1: if (s is in NVS) // a write group hit 2: if (the access is not sequential) 3: set the recencyBit of s to 1 4: endif 5: if (x is in NVS) // a page hit 6: set the recencyBit of s to 1 7: else 8: allocate x from FreePageQueue : and insert x in s 9: endif 10: else 11: allocate s from FreeStripeGroupHeaderQueue 12: allocate x from FreePageQueue 13: insert x into s and s into the sorted queue 14: initialize the recencyBit of s to 0 15: if (s is the only write group in NVS) 16: initialize the destagePointer to point to s 17: endif 18: endif DESTAGE POLICY: 19: while (needToDestage( )) 20: while (the recencyBit of the write group pointed to by the destagePointer is 1) 21: reset the recencyBit to 0 22: AdvanceDestagePointer( ) 23: endwhile 24: destage all pages in the write group pointed to by the destagePointer and move them to FreePageQueue 25: move the destaged write group to FreeStripeGroupHeaderQueue 26: AdvanceDestagePointer( ) 27: endwhile 28: AdvanceDestagePointer( ) 29: if (destagePointer is pointing to the highest address write group in the queue) 30: reset the destagePointer to point to the lowest address write group in the queue 31: else 32: advance the destagePointer to the next higher address write group in the queue 33: endif

In Table One, needToDestage is true when a local LRWQ is non-empty. Otherwise, it is false.

In the illustrated example, rank R1 has write groups WG5, WG6, WG7, WG8 and WG9 in write cache WXRX. Accordingly, list Q1 has indicia for write groups WG5-WG9 in sorted, circular order, as shown (“WG” prefixes omitted due to space limitations), wherein the lowest write group in the sequence, write group WG5, is next to the highest write group in the sequence, write group WG9. Similarly, rank R2 has write groups WG1, WG3, WG5, and WG7 in write cache WXRX, with write group WG1 next to write group WG7. Accordingly, list Q2 has indicia for write groups WG1, WG3, WG5, and WG7 in sorted, circular order, as shown. Similarly, rank R3 has write groups WG1, WG6, WG7, and WG9 in write cache WXRX. Accordingly, list Q3 has indicia for write groups WG1, WG6, WG7, and WG9 in sorted, circular order, as shown.

In addition, controller CXRX maintains a “recency” bit 310 with each write group in the respective lists Q1, Q2 and Q3, as follows. When a write group such as write group WG7 of rank R2 is added to write cache WXRX, indicia for write group WG7 of rank R2 is inserted in its correct sorted position in list Q2. Upon insertion, recency bit 310 for write group WG7 is set to zero, as shown. However, if another write occurs to the same write group WG7 while write group WG7 is in cache WXRX, i.e., if there is a write hit, the recency bit 310 of write group WG7 is set to one, as in the illustrated instance of FIG. 3.

For selecting which data to destage, according to the embodiment of the invention that includes the WOW algorithm of Table One, a selection proceeds somewhat as in CSCAN, wherein a destage pointer P1 traverses circular list Q1, pointer P2 traverses circular list Q2, and pointer P3 traverses circular list Q3, selecting write groups for destaging. However, according to the WOW algorithm of the present embodiment of the invention there are differences compared to straight CSCAN. For one thing, the queues Q1, Q2 and Q3 selected for destaging are limited as determined by the above described allocation among ranks R1, R2 and R3, i.e., responsive to the sums determined for queues LRWQ_R1, LRWQ_R2 and LRWQ_R3.

In the case of queue Q1, in the illustrated instance two write groups should be destaged for rank R1, according to the allocation determined as described above. Pointer P1 is initially pointing at write group WG8, so that write group WG8 and the next write group in clockwise order, write group WG9, would be selected for destaging. However, according to the illustrated embodiment of the present invention, an exception is made for write group sequences. Write groups WG8 and WG9 are part of a larger sequence that also includes write groups WG5, WG6 and WG7. Thus write group sequence exceptions are next described, according to an embodiment of the present invention.

It should be understood that although in the embodiment described herein above the WOW process of Table One is used to select which data to destage, different or additional processes may be used in other embodiments of the invention, including cache management algorithms such as CSCAN, SCAN, VSCAN, LRW, etc.

Exceptions for Sequences

In response to detecting that a number of write groups in an uninterrupted sequence are being added to a write cache, storage controller CXRX overrides the usual rule of selection and of setting a recency bit. That is, in the illustrated instance of FIG. 3, storage controller CXRX does not set the recency bits to 1 for the write groups WG5, WG6, WG7, WG8 and WG9 in list Q1 because all of the write groups are in a sequence. Likewise, storage controller CXRX does not set the recency bits to 1 for the write groups WG6 and WG7 in list Q3 because these two write groups are in a sequence. This heuristic, which is reflected in lines 2-4 of the psuedo-code of Table One, gives the bulky sequential stripes 104 a smaller life and frees up space in cache WXRX in the illustrated instance for a greater number of less populated stripes 104 that could potentially yield more hits.

There is another exception regarding sequences, as well. That is, if a storage controller CXRX pointer selects a write group for destaging that is a member of a sequence, then all the write groups in the sequence, are destaged. This rule applies even if the allocation determined as described above responsive to the high threshold and sum of write groups in a local LRWQ indicates that less write groups should be destaged.

Regarding Data Actually Selected for Destaging: Issues that Arise from Exceptions for Write Group Sequences

Since storage controller CXRX pointer P1 in queue Q1 selects write group WG8 for destaging and it is a member of a sequence of write groups WG5, WG6, WG7, WG8 and WG9 in list Q1, all five write groups are destaged, even though the allocation determined as described above responsive to the sum of write groups in local LRWQ_1 indicates that only two write groups should be destaged in queue Q1. Since controller CXRX destages five write groups in queue Q1 because they are in a sequence (instead of the two allocated to queue Q1 responsive to the sum of write groups in local LRWQ_1), and since controller CXRX determined responsive to the high threshold and sum of pages in global LRWQ that only three write groups should be destaged in this iteration of destaging, this leaves no write groups to destage from queue Q3 in this destaging iteration.

How Destaging Data Would Have Been Selected in Queue Q3

Although issues arising from sequencing exceptions result in no write groups to destage from queue Q3 in this destaging iteration, consider, for the sake of illustration, what data controller CXRX would have selected to destage if the write groups in queue Q1 had not been subjects of a write group sequence exception, so that only two write groups had been selected for destaging from queue Q1.

In the case of queue Q2, in the illustrated instance no write groups would have been destaged for rank R2, according to the allocation determined as described above. In the case of queue Q3, in the illustrated instance one write group should be destaged for rank R3, according to the allocation determined as described above and setting aside (for illustration purposes) the sequence exception that actually applies to queue Q1.

For a straight CSCAN algorithm, controller CXRX would have destaged write groups without exception as they were encountered by pointer P3 as the pointer traversed list Q3. Pointer P3 is initially pointing at write group WG1, so that write group WG1 would have been selected for destaging for a straight CSCAN algorithm. According to the WOW algorithm of the present embodiment of the invention, however, controller CXRX only destages a write group having a recency bit 310 of zero, so write group WG1, which has a recency bit of one, is skipped, i.e., not selected for destaging.

(Note that the recency bit 310 of such a skipped write group is reset to zero. That is, as explained herein above, extra life is given to a write group that is hit, by setting its recency bit back to one. Thus if write group WG1 is hit again before pointer P3 returns to it, the write group will again remain in write cache WXRX instead of being destaged. This incorporates recency, which relates to temporal locality, and also incorporates small average distance between consecutive destages, which relates to spatial locality.)

Write groups WG6, WG7 and WG9 have recency bits 310 of zero in the illustrated instance of queue Q3. Write group WG6 is the next write group in clockwise order, so just this one write group WG6 would have been selected for destaging, except that write group WG6 is also subject to the sequence exception referred to above, i.e., is part of a sequence including write groups WG6 and WG7. Thus, controller CXRX would have selected both WG6 and WG7 to destage, even though only one write group was allocated from queue Q3 based on the sum of write groups in queue LRWQ_3 that are older than the write group at the high threshold 305 in queue LRWQ.

Write Queue Depth

To utilize the full throughput potential of RAID array R1, R2, etc., it is crucial for storage controller CXRX to issue multiple concurrent writes. From the point of view of disk controller C1R1, for example, a destage operation from storage controller CXRX appears as a write request. This gives more choice to the scheduling algorithm of each disk controller C1R1, etc. (FIG. 2), which usually tries to maximize throughput without starving any I/Os. Furthermore, in RAID, the number of outstanding concurrent writes roughly dictates the number of disk D1R1, etc. heads that can be employed in parallel.

The number of outstanding concurrent writes for a storage controller CXRX at any given instant constitute a concurrent write queue (not shown). It should be understood that the concurrent write queue for controller CXRX is the set of lists Q1, Q2, etc. or, more frequently, a subset of the lists. (As previously stated, it should be understood that list Q1, for example, is typically much larger in actual practice than the five write groups shown in the illustrative example of FIG. 3.)

As the length of the concurrent write queue increases, both throughput and average write response time increases. Correspondingly, as the length of the concurrent write queue increases, reads suffer due to increased waiting for writes. According to an embodiment of the present invention, the concurrent write queue has maximum of MAXQUEUE concurrent write requests to the disks, where MAXQUEUE is some predetermined amount such as twenty or forty, or some such amount×the number of ranks, and a write request is a set of contiguous pages within one write group.

When to Destage

To address the issue of when to destage, which arises in line 19 of the processes set out in Table One, storage controller CXRX dynamically varies the number of outstanding destages, i.e., concurrent write requests, responsive to space in write cache WXRX. Alternatively, this may apply to space allocated for local LRWQ's instead of write cache WXRX.

Specifically, storage controller CXRX initially sets a lowThreshold and a highThreshold to 80% and 90%, respectively, of the size of write cache WXRX. If write cache WXRX occupancy, i.e., the amount of data in the write cache, falls below the lowThreshold and storage controller CXRX is not destaging a sequential write group, storage controller CXRX stops all destages. However, if write cache WXRX occupancy falls below the lowThreshold for a write group marked sequential, and if the next candidate destage is also marked sequential, then storage controller CXRX continues destaging at a slow and steady rate of four outstanding destages at any time. This ensures that sequences are not broken and their spatial locality is exploited in a more nearly complete fashion. Further, this also takes advantage of sequential bandwidth of disks D1R1, etc.

If write cache WXRX occupancy is at or above the highThreshold, then storage controller CXRX always destages at the maximum rate of MAXQUEUE concurrent write requests.

If write cache WXRX occupancy is below the highThreshold and above the lowThreshold, storage controller CXRX linearly varies the rate of destage from lowThreshold to highThreshold. That is, within this range between highThreshold and lowThreshold, storage controller CXRX increases the number of outstanding concurrent writes responsive to decreasing space in the write cache WXRX.

Note that this linear variation in the rate of destaging will not always use the maximum queue depth MAXQUEUE. This is because writing at full throttle regardless of the rate of new writes is generally bad for performance. A steady rate of destage is more effective than a lot of destages at one time and very few at another. What is desired is simply to keep up with the incoming write load without filling up write cache WXRX. Dynamically ramping up the number of outstanding concurrent writes responsive to decreasing space in write cache WXRX helps to achieve a steady rate.

As stated herein above, storage controller CXRX initially sets lowThreshold to 80% and highThreshold to 90% of the size of write cache WXRX. However, because write response times can become quite large if write cache WXRX ever becomes full, storage controller CXRX also dynamically adjusts the level of highThreshold by incrementing and decrementing its value responsive to write cache occupancy. Storage controller CXRX also adjusts lowThreshold responsive to the level of highThreshold. This adaptive back-off and advance arrangement attempts to avoid filling up write cache WXRX, while still attempting to maximize write cache WXRX occupancy.

More specifically, storage controller CXRX sets a desiredOccupancyLevel to 90% of the write cache WXRX size and also maintains a certain maximum occupancy variable, maxOccupancyObserved, that indicates the maximum occupancy of write cache WXRX since the last time the variable was reset. Responsive to the write cache WXRX occupancy dropping below the current highThreshold, storage controller CXRX decrements the highThreshold by any positive difference between maxoccupancyObserved and desiredOccupancyLevel and resets maxOccupancyObserved to the current occupancy level. Storage controller CXRX also adjusts the lowThreshold to the level of highThreshold minus 10% of write cache WXRX size. If, after a certain number of destages, maxOccupancyObserved is lower than desiredOccupancyLevel, then storage controller CXRX increments highThreshold by the difference between desiredOccupancyLevel and maxOccupancyObserved, resets maxOccupancyObserved to the current occupancy level, and again adjusts the lowThreshold to the level of highThreshold minus 10% of write cache WXRX size.

In one embodiment of the invention, the certain number of destages is equal to a certain reset interval variable, resetInterval, that storage controller CXRX maintains. That is, storage controller CXRX accumulates in the resetInterval variable a count of how many destage operations occur between two consecutive resettings of maxOccupancyObserved.

Although storage controller CXRX increments and decrements the value of highThreshold as described herein above, it does not allow highThreshold to be higher than the desiredOccupancyLevel or lower than 10% of write cache WXRX size.

Block Diagram of Typical Storage Controller

Referring now to FIG. 4, a block diagram of storage controller CXRX of FIGS. 1-3 is shown, for an embodiment of the present invention. Storage controller CXRX includes storing logic 410 for performing the process of temporarily storing write groups in the write cache responsive to the write groups being written to the array, i.e., adding a new write group to the write cache responsive to a write-to-disk operation.

Storage controller CXRX also includes global logic 415 for assigning that write group to a global queue, such as by placing indicia of that write group in the global queue. Logic 415 orders the write groups in the global queue by age.

Storage controller CXRX also includes listing logic 420 for performing the process of listing the write groups in the write cache in order of their sequence in the respective arrays. Listing logic 420 does this, according to an embodiment of the invention, by assigning the write groups to respective circular local queues for the respective arrays. Thus, in an embodiment listing logic 420 includes logic operable for storing, for the write groups in the write cache, indicia in circular local queues for the write groups' respective arrays, where the indicia is ordered according to the write group sequences in such arrays. In such a circular local queue, a lowest one of the write groups is listed next to a highest one of the write group.

Global logic 415 includes a predetermined high threshold storage value for the write groups in the global queue and includes Global destaging quantity logic 417 includes logic operable to determine a write group in the global queue having a page corresponding to the high threshold value, as follows. Logic 417 places a high threshold marker at the top of the global queue and moves the marker down the global queue, write group by write group, adding numbers of pages included in the respective write groups, thereby accumulating a sum of pages as the marker proceeds down the global queue. Logic 417 continues accumulating this sum down the global queue in this fashion until the high threshold marker reaches a write group in the global queue having a number of pages such that when added to the accumulating sum of pages the number causes the sum to first equal or exceed the threshold amount. At such point, the high threshold marker is marking the write group in the global queue corresponding to the high threshold storage value. Logic 417 selects write groups in the global queue older than the write group marked by the high threshold marker. The quantity of those selected write groups determines a quantity of write groups for attempted destaging to the arrays.

Storage controller CXRX also includes allocating logic 425 for allocating, among the disk arrays, that quantity of write groups selected by logic 417. Logic 425 includes logic operable to assign the write groups selected by logic 417 to local array allocation queues for the respective arrays, such as by placing indicia for the write groups in the array allocation queues corresponding to the arrays of the write groups. Logic 425 includes logic operable to count write groups assigned to each of the local array allocation queues to determine allocation quantities for attempted destaging to the respective arrays.

Referring once again to the circular local queues, in which listing logic 420 listed those write groups that are in the write cache, storage controller CXRX also includes selecting logic 430 for performing the process of selecting the listed write groups from the circular queues. Selecting logic 430 rotates the selecting according to the sequence of the write groups. That is, selecting logic 430 advances a pointer for such a circular queue from one listed write group to the next listed write group in the sequence. Selecting logic 430 also selects ones of the write groups indicated in the circular local queues in quantities corresponding to the allocation quantities determined by allocating logic 425.

Storage controller CXRX includes recency logic 440 for performing the process of setting recency bits for the listed write groups in such a circular queue responsive to the respective write groups being written to, and for clearing the recency bits response to the respective write groups being selected.

Storage controller CXRX includes destaging logic 450 for destaging such a write group from the write cache to the disk responsive to selecting logic 430 selecting the listed write group, provided that the recency bit for the selected write group is clear. In one embodiment of the invention, such a clear recency bit may indicate that the selected write group has not been written to since storage controller CXRX selected the write group in a previous rotation, or else that the selected write group has not been written to at least since it was placed in the write cache. In one embodiment of the invention, recency logic 440 also sets such a bit responsive to a write group being initially placed in the write cache, which eliminates destaging of the selected write group if it has not been written to merely since it was placed in the write cache but before it has been previously selected.

Controller CXRX includes destaging write request issue logic 460, which includes a destaging write request queue 465. Issue logic 460 performs the process of issuing numerous, concurrent destaging write requests to ones of the disks, the number of which are varied responsive to space in the shared write cache. Issue logic 460 may vary the concurrent write requests by issuing concurrent destaging write requests at a certain predetermined maximum rate responsive to write cache space exceeding the certain high threshold. Issue logic 460 may also vary the concurrent write requests by increasing the number of concurrent destaging write requests responsive to decreasing space in the write cache if the write cache space is within a range between a certain high threshold and a certain low threshold. Issue logic 460 may also vary the concurrent write requests by issuing concurrent destaging write requests at a certain predetermined minimum rate responsive to write cache space falling below the low threshold for a write group that is a member of a sequence of write groups in the write cache, if a next listed write group for destaging is also a member of a sequence of write groups. Issue logic 460 may also vary the concurrent write requests by issuing no write requests responsive to the write cache space falling below the low threshold for a write group that is not a member of a sequence of write groups in the write cache.

General Remarks and Variations

WOW may be compared and contrasted to LRW or CLOCK, and CSCAN as follows. WOW destages in essentially the same order as CSCAN. However, WOW skips destaging of writes that are likely to be written to again, which is different than CSCAN. WOW generally will have a higher hit ratio than CSCAN at the cost of an increased gap between consecutive destages. WOW skips write groups that are likely to be written to again, by granting a new life to a write group responsive to a write hit until the destage pointer returns to it again, which is in a fashion like CLOCK. However, WOW inserts new write groups according to their sequential location in the disk array linear address space, rather than immediately behind the destage pointer as in CLOCK. Thus WOW does not always grant life to each newly inserted write group for one full rotation of the destage pointer as in CLOCK. WOW has a significantly smaller gap between consecutive destages than LRW at the cost of a generally lower hit ratio. In a system according to an embodiment of the present invention, it has been found that throughput increases for a wide variety of workloads as the size of the write cache increases.

Although it might superficially seem that it would, WOW does not strictly simulate disk head position for a number of reasons. First, concurrent read misses may be happening, which can take the disk heads to arbitrary locations on disks. Second, the position of the heads cannot be strictly controlled, for example, due to read-modify-write in RAID-5. And third, at a lower level, either the RAID array storage controller or the individual disk controllers may re-order concurrent write requests. WOW does tend to spatially localize disk heads to a relatively narrow region of the disks, so that resulting disk seeks are less expensive than would be random disk seeks which would tend to move the head across a larger number of cylinders on the disks.

In tests, WOW exhibited better or comparable peak throughput to the best of CSCAN and LRW across a wide gamut of write cache sizes and workload configurations. In addition, even at lower throughputs WOW had lower average response times than CSCAN and LRW. Also, both cache-insensitive and cache-sensitive regimes were explored as cache size was varied. This showed that CSCAN was good for cache-insensitive regimes, LRW was good for cache-insensitive regimes, and WOW was good across a range of cache sizes. In summary, WOW is a practical algorithm that fundamentally enhances the capacity of a storage controller to perform more I/Os.

The processes require simple data structures, including a sorted queue for storing write groups; a hash-based lookup for checking whether a write group is presented in the sorted queue, that is, for hit/miss determination; and a destage pointer for determining the next candidate write group for destage. The fact that sorting is an O(log(n)) algorithm does not present a practical problem due to the limited sizes of write cache and the cheap availability of computational power.

In addition to the embodiment of the invention described herein above, the invention has numerous other embodiments. Arising from a recognition that frequency is another feature of workloads indicating temporal locality, another embodiment of the invention uses counters as recency indicators for respective write groups instead of merely single recency bits. That is, for example, recency logic increments a recency counter for a listed write group each time the write group is written to, and decrements the recency counter each time the write group is selected. Destaging logic for destages the write group from the write cache to the disk responsive to selecting logic selecting the write group, provided that the recency counter for the selected write group is not larger than a certain predetermined minimum value.

In another variation, recency logic increments a recency counter for a listed write group according to the number of pages written to in the write group, such as by one count per page written to. The recency logic decrements the recency counter each time the write group is selected. Destaging logic for destages the write group from the write cache to the disk responsive to selecting logic selecting the write group, provided that the recency bit for the selected write group is not larger than a certain predetermined minimum value.

Herein above, an embodiment was described in which a storage controller overrides the usual rule of setting a recency bit in response to detecting that a number of write groups in an uninterrupted sequence are being added to the array storage controller write cache. In an alternative embodiment of the invention, instead of overriding the usual rule of setting a recency bit, if any one of a number of write groups in an uninterrupted sequence in the array storage controller write cache are selected by the sorted, circular list pointer for destaging, the storage controller destages all the write groups in the sequence, regardless of the states of their recency bits.

Herein above, a write cache was described as being non-volatile. It should be understood that in other embodiments it is possible for the disk array write cache to be volatile, although this is not necessarily preferred. In various embodiments of the invention, the disk array may or may not include a read cache. A side benefit of maintaining a write cache is the read hits that it produces. The write caching processes of the present invention are not primarily intended to improve read hit ratio, since the read cache is larger and more effective in producing read hits. Nevertheless, in an embodiment of the present invention the storage controller checks the write cache for these not-so-numerous read hits and, for coherency, i.e., consistency, purposes, returns data from the write cache if there is a hit.

In an embodiment described herein above, a recency bit for a write group is set to zero upon insertion of the write group to the write cache. In another embodiment of the invention, the recency bit is set to 1 when the write group is initially inserted. This way, if the pointer happens to be almost to the newly inserted write group in its rotation when the write group is initially inserted, the write group will not be immediately destaged. That is, this variation eliminates destaging of the selected write group if it has not been written to merely since it was placed in the write cache, but before it has been previously selected, i.e., pointed at.

The description of the present embodiment has been presented for purposes of illustration, but is not intended to be exhaustive or to limit the invention to the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. For example, it should be understood that the one or more RAID storage controllers may be integrated in a computer system or may be external. Further, while the present invention has been described in the context of one or more RAID storage controllers implemented in hardware, which may include, for example application-specific integrated circuitry, those of ordinary skill in the art will appreciate that the logic of the storage controller described may be implemented by software processes. This is particularly the case since the present invention does not depend on any particular implementation of a RAID controller. Moreover, the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions. Such computer readable medium may have a variety of forms. The present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media such a floppy disc, a hard disk drive, a RAM, and CD-ROMs and transmission-type media such as digital and analog communications links.

Various embodiments implement the one or more software programs in various ways, including procedure-based techniques, component-based techniques, and/or object-oriented techniques, among others. Specific examples include XML, C, C++ objects, Java and commercial class libraries. Those of ordinary skill in the art will appreciate that the hardware depicted herein may vary depending on the implementation. For example, other peripheral devices may be used in addition to or in place of the hardware depicted in FIG. 3. The depicted example is not meant to imply architectural limitations with respect to the present invention.

The terms “logic” and “memory” are used herein. It should be understood that these terms refer to circuitry that is part of the design for an integrated circuit chip. The chip design is created in a graphical computer programming language, and stored in a computer storage medium (such as a disk, tape, physical hard drive, or virtual hard drive such as in a storage access network). If the designer does not fabricate chips or the photolithographic masks used to fabricate chips, the designer transmits the resulting design by physical means (e.g., by providing a copy of the storage medium storing the design) or electronically (e.g., through the Internet) to such entities, directly or indirectly. The stored design is then converted into the appropriate format (e.g., GDSII) for the fabrication of photolithographic masks, which typically include multiple copies of the chip design in question that are to be formed on a wafer. The photolithographic masks are utilized to define areas of the wafer (and/or the layers thereon) to be etched or otherwise processed.

The resulting integrated circuit chips can be distributed by the fabricator in raw wafer form (that is, as a single wafer that has multiple unpackaged chips), as a bare die, or in a packaged form. In the latter case the chip is mounted in a single chip package (such as a plastic carrier, with leads that are affixed to a motherboard or other higher level carrier) or in a multichip package (such as a ceramic carrier that has either or both surface interconnections or buried interconnections). In any case the chip is then integrated with other chips, discrete circuit elements, and/or other signal processing devices as part of either (a) an intermediate product, such as a motherboard, or (b) an end product. The end product can be any product that includes integrated circuit chips, ranging from toys and other low-end applications to advanced computer products having a display, a keyboard or other input device, and a central processor.

To reiterate, the embodiments were chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention. Various other embodiments having various modifications may be suited to a particular use contemplated, but may be within the scope of the present invention.

Herein above, and in the following claims, the term “comprises” is synonymous with “includes.” The use of terminology such as “X comprises A, B and C” is not intended to imply that A, B and C are necessarily all of the components of X.

Unless clearly and explicitly stated, the claims that follow are not intended to imply any particular sequence of actions. The inclusion of labels, such as a), b), c) etc., for portions of the claims does not, by itself, imply any particular sequence, but rather is merely to facilitate reference to the portions. 

1. A method of destaging a computer readable write cache in a storage system having an number of arrays of storage disks, such an array having a rank of data ordered in a sequence of write groups, wherein the write cache is shared by the disk arrays, the method comprising the steps of: a) storing ones of the write groups in the write cache temporarily responsive to the ones of the write groups being written to their respective arrays; b) assigning the write groups stored in the write cache to a global queue, wherein the write groups in the global queue are ordered by ages of the write groups; c) selecting a quantity of write groups for attempted destaging to the arrays responsive to a predetermined high threshold for the global queue and to sizes and the ages of the write groups in the global queue; d) allocating the selected quantity among the arrays responsive to quantities of certain ones of the write groups in the global queue, so that the arrays have respective allocation quantities of write groups for destaging; and e) destaging ones of the write groups in the write cache to the arrays, wherein write groups are destaged to such an array responsive to i) the selected allocation quantity for the array and ii) the sequences of the write groups in the array.
 2. The method of claim 1, wherein the storage controller has an associated predetermined high threshold storage value for the write groups in the global queue, and selecting a quantity of write groups for attempted destaging to the arrays includes: determining the write group in the global queue having the page corresponding to the high threshold value.
 3. The method of claim 2, wherein determining the write group in the global queue having the page corresponding to the high threshold value includes: accumulating a sum of pages proceeding down the global queue until reaching a write group in the global queue having a number of pages such that when added to the accumulating sum of pages the number causes the sum to first equal or exceed the high threshold value, wherein the write group thus reached corresponds to the high threshold storage value.
 4. The method of claim 3, including: selecting certain ones of the write groups in the global queue, the certain ones being older than the write group corresponding to the high threshold storage value, wherein the quantity of those selected certain ones of the write groups determines a quantity of write groups for attempted destaging to the arrays.
 5. The method of claim 4, wherein allocating the selected quantity among the arrays includes: assigning the selected certain ones of the write groups stored in the write cache to array allocation queues for the respective arrays.
 6. The method of claim 5, wherein allocating the selected quantity among the arrays includes: counting write groups assigned to each of the local array allocation queues to determine allocation quantities for attempted destaging to the respective arrays.
 7. The method of claim 6, including storing, for the write groups in the write cache, indicia in circular local queues for the write groups' respective arrays, the indicia being ordered according to the write group sequences in such arrays, wherein in such a circular local queue a lowest one of the write groups is listed next to a highest one of the write groups, and wherein destaging ones of the write groups includes selecting ones of the write groups indicated in the circular local queues in quantities corresponding to the allocation quantities.
 8. A computer program product for destaging a computer readable write cache in a storage system having an number of arrays of storage disks, such an array having a rank of data ordered in a sequence of write groups, the write cache being shared by the disk arrays, wherein the computer program product resides on a computer readable medium having computer readable program code and the program code comprises: instructions for storing ones of the write groups in the write cache temporarily responsive to the ones of the write groups being written to their respective arrays; instructions for assigning the write groups stored in the write cache to a global queue, wherein the write groups in the global queue are ordered by ages of the write groups; instructions for selecting a quantity of write groups for attempted destaging to the arrays responsive to a predetermined high threshold for the global queue and to sizes and the ages of the write groups in the global queue; instructions for allocating the selected quantity among the arrays responsive to quantities of certain ones of the write groups in the global queue, so that the arrays have respective allocation quantities of write groups for destaging; and instructions for destaging ones of the write groups in the write cache to the arrays, wherein write groups are destaged to such an array responsive to i) the selected allocation quantity for the array and ii) the sequences of the write groups in the array.
 9. The computer program product of claim 1, including a predetermined high threshold storage value for the write groups in the global queue, wherein the instructions for selecting a quantity of write groups for attempted destaging to the arrays include: instructions for determining the write group in the global queue having the page corresponding to the high threshold value.
 10. The computer program product of claim 2, wherein the instructions for determining the write group in the global queue having the page corresponding to the high threshold value include: instructions for accumulating a sum of pages proceeding down the global queue until reaching a write group in the global queue having a number of pages such that when added to the accumulating sum of pages the number causes the sum to first equal or exceed the high threshold value, wherein the write group thus reached corresponds to the high threshold storage value.
 11. The computer program product of claim 3, including: instructions for selecting certain ones of the write groups in the global queue, the certain ones being older than the write group corresponding to the high threshold storage value, wherein the quantity of those selected certain ones of the write groups determines a quantity of write groups for attempted destaging to the arrays.
 12. The computer program product of claim 4, wherein the instructions for allocating the selected quantity among the arrays include: instructions for assigning the selected certain ones of the write groups stored in the write cache to array allocation queues for the respective arrays.
 13. The computer program product of claim 5, wherein the instructions for allocating the selected quantity among the arrays include: instructions for counting write groups assigned to each of the local array allocation queues to determine allocation quantities for attempted destaging to the respective arrays.
 14. The computer program product of claim 6, including instructions for storing, for the write groups in the write cache, indicia in circular local queues for the write groups' respective arrays, the indicia being ordered according to the write group sequences in such arrays, wherein in such a circular local queue a lowest one of the write groups is listed next to a highest one of the write groups, and wherein the instructions for destaging ones of the write groups includes instructions for selecting ones of the write groups indicated in the circular local queues in quantities corresponding to the allocation quantities.
 15. A storage system comprising: a number of arrays of storage disks, such an array being ordered in an sequence of write groups; a write cache shared by the disk arrays; a storage controller, wherein the storage controller includes: storing logic for storing ones of the write groups in the write cache temporarily responsive to the ones of the write groups being written to their respective arrays; global logic for assigning the write groups stored in the write cache to a global queue, wherein the write groups in the global queue are ordered by ages of the write groups; destaging quantity logic for selecting a quantity of write groups for attempted destaging to the arrays responsive to a predetermined high threshold for the global queue and to sizes and the ages of the write groups in the global queue; allocating logic for allocating the selected quantity among the arrays responsive to quantities of certain ones of the write groups in the global queue, so that the arrays have respective allocation quantities of write groups for destaging; and destaging logic for destaging ones of the write groups in the write cache to the arrays, wherein write groups are destaged to such an array responsive to i) the selected allocation quantity for the array and ii) the sequences of the write groups in the array.
 16. The storage system of claim 15, wherein the storage controller has an associated predetermined high threshold storage value for the write groups in the global queue, and the destaging quantity logic for selecting a quantity of write groups for attempted destaging to the arrays includes: logic for determining the write group in the global queue having the page corresponding to the high threshold value.
 17. The storage system of claim 16, including: selecting logic for selecting certain ones of the write groups in the global queue, the certain ones being older than the write group corresponding to the high threshold storage value, wherein the quantity of those selected certain ones of the write groups determines a quantity of write groups for attempted destaging to the arrays.
 18. The storage system of claim 17, wherein the allocating logic includes: logic for assigning the selected certain ones of the write groups stored in the write cache to array allocation queues for the respective arrays.
 19. The storage system of claim 18, wherein the allocating logic includes: logic for counting write groups assigned to each of the local array allocation queues to determine allocation quantities for attempted destaging to the respective arrays.
 20. The storage system of claim 19, including: listing logic for storing, for the write groups in the write cache, indicia in circular local queues for the write groups' respective arrays, the indicia being ordered according to the write group sequences in such arrays, wherein in such a circular local queue a lowest one of the write groups is listed next to a highest one of the write groups, and wherein the selecting logic includes logic for selecting ones of the write groups indicated in the circular local queues in quantities corresponding to the allocation quantities. 